<?php
echo validation_errors();

echo form_open(uri_string());

echo '<table>';

if (isset($data)) {
	$type = 'update';
} else {
	$type = 'create';
}

foreach ($items as $item) {
	if (strstr($item['display'], $type)) {
		if (!$val = set_value($item['field'])) {
			if (isset($data)) $val = $data[$item['field']];
		}
		
		echo '<tr><td>' . $item['label'] . '</td><td><input name="' . $item['field'] . '" value="' . $val . '" /></td></tr>';
	}
}

?>
<tr><td colspan="2"><input type="submit" value="Submit" /></td></tr>
</table>
</form>